<template>
  <div>
    <li v-for="(i, index) in nameList" :key="index">{{ i }}</li>
    <GrandSon v-bind="$attrs"></GrandSon>
  </div>
  <button @click="emitAbc">点我自定义事件</button>
</template>
<script setup lang="ts">
import type { Person } from '@/types'
import GrandSon from './GrandSon.vue'

const emit = defineEmits(['abc'])

const emitAbc = () => {
  emit('abc', { hello: 'world' })
}

// defineProps(['nameList'])
// defineProps<{nameList:Person[]}>()
// 属性 限制类型 默认值 必要性
withDefaults(defineProps<{ nameList?: Person[] }>(), {
  nameList: () => [{ name: '小吕', age: 15 }]
})
</script>
<style lang="scss" scoped></style>
